package com.rran.study.designpattern.behavioral.observer.publisher;

import com.rran.study.designpattern.behavioral.observer.event.app.AppEvent;

/**
 * @author yy
 * @Type EventPublisher.java
 * @Desc
 * @date 2020/7/21 20:00
 */
@FunctionalInterface
public interface AppEventPublisher {

    default void publishEvent(AppEvent event, boolean async) {
        this.publish(event, async);
    }

    default void publishEvent(AppEvent event) {
        this.publish(event,false);
    }

    /**
     * 发布事件
     * @param event
     * @param async 是否异步
     */
    void publish(AppEvent event, boolean async);
}
